abstract class Employee{
    public abstract double earnings();
}

class YearWorker extends Employee{
    public double earnings(){
        return 15000;
    }
}

class MonthWorker extends Employee{
    public double earnings(){
        return 12 * 6300;
    }
}

class WeekWorker extends Employee{
    public double earnings(){
        return 52 * 780;
    }
}

class Company{
    Employee[] employees;
    double salaries = 0;
    Company(Employee[] employees){
        this.employees = employees;
    }

    public double salariesPay(){
        salaries = 0;
        for(int i = 0; i < employees.length; i++){
            salaries = salaries + employees[i].earnings();
        }
        return salaries;
    }
}

public  class CompanySalary {
    public static void main(String[] args) {
        Employee [] employees = new Employee[29];
        for(int i = 0; i < employees.length; i++){
            if(i % 3 == 0) employees[i] = new WeekWorker();
            else if(i % 3 == 1) employees[i] = new MonthWorker();
            else if(i % 3 == 2) employees[i] = new YearWorker();
        }
        Company company = new Company(employees);
        System.out.println("公司薪水总额: " + company.salariesPay() + " 元");
    }
}